<?php 
include "includes/session.php";
include "includes/comunes.php";
require_once("includes/paginator.class.php");
$sql="select * from stock_remito where RemitoId=".$_GET['rem_id'];
$resPro=  cons_sql_up($sql);
$regPro=mysql_fetch_array($resPro);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="refresh" CONTENT="300"/>
<title>Sistema de Registro de Atencion</title>

<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->

<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<!--libreria flexigrid-->
<link rel="stylesheet" type="text/css" href="jquery-ui/css/ui-flexigrid/flexigrid.css">
    <script type="text/javascript" src="jquery-ui/js/flexigrid.js"></script>
<!--fin libreria-->
<!--VENTANA MODAL -->
<link href="modal/styles/modal-window.css" type="text/css" rel="stylesheet" /> 
 
		<script type="text/javascript" language="javascript" src="modal/scripts/modal-window.min.js"></script>  


<script language="JavaScript" type="text/javascript">
$(function()
{

<?php  for ($a=1;$a<=20;$a++):?>
		
		$( "#codigo<?php echo $a?>" ).autocomplete({
			source: "autoArticulosCompleto.php"
		});
              
<?php endfor?>

//multiplico los valores 
<?php  for ($a=1;$a<=20;$a++):?>
$(document).on("change","#precio<?php echo $a?>",function(){
                        precio = $("#precio<?php echo $a?>").val() ;
						cantidad = $("#cant<?php echo $a?>").val() ;
						total = precio * cantidad;
						
						$("#total<?php echo $a?>").val(total);
             });
<?php endfor?>

<?php  for ($a=1;$a<=20;$a++):?>
$(document).on("change","#cant<?php echo $a?>",function(){
                        precio = $("#precio<?php echo $a?>").val() ;
						cantidad = $("#cant<?php echo $a?>").val() ;
						total = precio * cantidad;
						
						$("#total<?php echo $a?>").val(total);
             });
<?php endfor?>



	  $( "#menu" ).menu({position: {at: "left bottom"}});

});
</script>



</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal"><img src="jquery-ui/css/ui-flexigrid/images/magnifier.png" width="25" height="25" border="0"/> Visualizar Remito <?php echo $regPro['RemitoId']?>
           <?php include 'includes/submenu.php';?>  
           </div>
       
       <div class="contenedorpedido">
       <form id="altapedido" name="altapedido" method="POST" action="grabarOrdenCompra.php">
        <fieldset>
             <legend><b>Datos de Cabecera</b></legend>
             <table width="100%">
               <tr>

                    <td class="textotablamenuform">Fecha</td>
                    <td class="textotablamenuform">
					<input type="text" name="fecha" id="fecha" disabled value="<?php echo format_fec($regPro['RemitoFecha'],"/")?>" class="campo_form" />
					</td>
                    
                    
<td class="textotablamenuform"></td>				
                 </tr>
                 <tr>
                      <td class="textotablamenuform">Sucursal Origen</td>
                    <td class="textotablamenuform">
					<input type="text" name="fecha" id="fecha" disabled value="<?php echo obtener_sucursal_nombre($regPro['RemitoOrigen'])?>" class="campo_form" />
					
					</td>
                     
                    
                 </tr>
				 <tr>
                    <td class="textotablamenuform">Sucursal Destino</td>
                    <td class="textotablamenuform">
					<input type="text" name="fecha" id="fecha" disabled value="<?php echo obtener_sucursal_nombre($regPro['RemitoDestino'])?>" class="campo_form" />
					
					
					</td>
                    
                 </tr>
                   
             </table>
        </fieldset>
      
           <fieldset>
             <legend><b>Detalle de Remito</b></legend>
             
             </br>

             <table >
			 <tr>
			 <td class="textotablamenuform" style="width:90%;">Articulo</td>
			 <td class="textotablamenuform">Cant. </td>
			
			 </tr>
  
               <tbody>

                <?php
                $sql="select * from stock_remito_detalle where DetalleRemito=".$regPro['RemitoId'];
				$resDetPro=  cons_sql_up($sql);
				while($regDet=mysql_fetch_array($resDetPro)):?>
                  <tr id="fila<?php echo $i?>">
                    <td ><input  type="text" disabled style="width:90%;" name="codigo<?php echo $i?>" id="codigo<?php echo $i?>"  value="<?php echo $regDet['DetalleCodigo']."  ".obtener_nombre_producto($regDet['DetalleCodigo'])?>" class="campo_form"/></td>
					<td ><input  type="number" disabled  name="cant<?php echo $i?>" id="cant<?php echo $i?>"  style="width:90%;" value="<?php echo $regDet['DetalleCantidad']?>" class="campo_form"/></td> 
					
                     
                  </tr>
                 <?php
                 endwhile
                
                 ?>

                  
                </tbody>

             </table>
             

        </fieldset>
       
		 </form>
       </div>
 
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>


</body>
</html>
